Method and apparatus for selecting a coding mode

ABSTRACT

A method and apparatus for selecting a coding mode are described. For example, the method receives at least one block of a signal to be encoded. The method determines a frame vertical pixel difference in the at least one block and determines a field vertical pixel difference in the at least one block. The method then compares the frame vertical pixel difference with the field vertical pixel difference to determine a first coding mode for the at least one block.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to video encoders and, more particularly,to a method and apparatus for selecting a coding mode (e.g., a framecoding mode or a field coding mode).

2. Description of the Background Art

The International Telecommunication Union (ITU) H.264 video codingstandard is able to compress video much more efficiently than earliervideo coding standards, such as ITU H.263, MPEG-2 (Moving PictureExperts Group), and MPEG-4. H.264 is also known as MPEG-4 Part 10 andAdvanced Video Coding (AVC). H.264 exhibits a combination of newtechniques and increased degrees of freedom in using existingtechniques. Among the new techniques defined in H.264 are 4×4 and 8×8integer transform (e.g., DCT-like integer transform), multi-frameprediction, context adaptive variable length coding (CAVLC), SI/SPframes, context-adaptive binary arithmetic coding (CABAC), and adaptiveframe/field coding. The increased degrees of freedom come about byallowing multiple reference frames for prediction and many moretessellations of a 16×16 pixel macroblock (MB). These new tools andmethods add to the coding efficiency at the cost of increased encodingand decoding complexity in terms of logic, memory, and number ofoperations. This complexity far surpasses those of H.263 and MPEG-4 andbegs the need for efficient implementations.

The H.264 standard belongs to the hybrid motion-compensated DCT (MC-DCT)family of codecs. H.264 is able to generate an efficient representationof the source video by reducing temporal and spatial redundancies.Temporal redundancies are removed by a combination of motion estimation(ME) and motion compensation (MC). ME is the process of estimating themotion of a current frame in the source video from previously codedframe(s). This motion information is used to motion compensate thepreviously coded frame(s) to form a prediction for the current frame.The prediction is then subtracted from the original current frame toform a displaced frame difference (DFD). The motion information ispresent for each block of pixel data. In H.264, there are seven possibleblock sizes within a macroblock, e.g., 16×16, 16×8, 8×16, 8×8, 8×4, 4×8,and 4×4 (also referred to as tessellations or partitions). Thus, a 16×16pixel macroblock (MB) can be tessellated into the following partitions:(A) one 16×16 macroblock region; (B) two 16×8 tessellations; (C) two8×16 tessellations; and (D) four 8×8 tessellations. Furthermore, each ofthe 8×8 tessellations can be decomposed into: (a) one 8×8 region; (b)two 8×4 regions; (c) two 4×8 regions; and (d) four 4×4 regions.

Furthermore, the motion vector for each block is unique and can point todifferent reference frames. The job of the encoder is to find theoptimal way of breaking down a 16×16 macroblock into smaller blocks(along with the corresponding motion vectors) in order to maximizecompression efficiency. This breaking down of the macroblock into aspecific pattern is commonly referred to as “mode selection” or “modedecision.”

In addition, the H.264 standard allows for the adaptive switchingbetween frame coding and field coding modes. Notably, this type ofswitching can occur at both the picture and the macroblock (MB) pairlevels. However, present day processes are typically exhaustive in thesense that H.264 encoders encode a picture by completely executing bothframe coding and field coding techniques and subsequently comparing thetwo end products to see which one performed better. Namely, each pictureis encoded in its entirety twice. This approach is computationallyexpensive.

Accordingly, there exists a need in the art for a method and apparatusfor an improved adaptive frame/field mode selection encoding method.

SUMMARY OF THE INVENTION

In one embodiment, a method and apparatus for selecting a coding modeare described. For example, the method receives at least one block of asignal to be encoded. The method determines a frame vertical pixeldifference in the at least one block and determines a field verticalpixel difference in the at least one block. The method then compares theframe vertical pixel difference with the field vertical pixel differenceto determine a first coding mode for the at least one block.

In an alternate embodiment, a method and apparatus for selecting acoding mode are described. For example, the method receives at least oneblock of a signal to be encoded. The method then determines a fieldcoding cost of the at least one block in accordance with a field codingmode and determines a frame coding cost of the at least one block inaccordance with a frame coding mode. The method then compares the framecoding cost with the field coding cost to determine a coding mode forthe at least one block.

BRIEF DESCRIPTION OF DRAWINGS

So that the manner in which the above recited features of the presentinvention can be understood in detail, a more particular description ofthe invention, briefly summarized above, may be had by reference toembodiments, some of which are illustrated in the appended drawings. Itis to be noted, however, that the appended drawings illustrate onlytypical embodiments of this invention and are therefore not to beconsidered limiting of its scope, for the invention may admit to otherequally effective embodiments.

FIG. 1 is a block diagram depicting an exemplary embodiment of a videoencoder;

FIG. 2 is a flow diagram depicting an exemplary embodiment of a methodfor a selecting a coding mode in accordance with one or more aspects ofthe invention;

FIG. 3 is a flow diagram depicting an exemplary embodiment of a methodfor a frame and field mode selection process in accordance with one ormore aspects of the invention;

FIG. 4 is a flow diagram depicting an exemplary embodiment of a methodfor a frame and field mode selection process for an I-picture inaccordance with one or more aspects of the invention;

FIG. 5 is a flow diagram depicting an exemplary embodiment of a methodfor a frame and field mode selection process for a P- and B-picture inaccordance with one or more aspects of the invention; and

FIG. 6 is a block diagram depicting an exemplary embodiment of a generalcomputer suitable for implementing the processes and methods describedherein.

To facilitate understanding, identical reference numerals have beenused, where possible, to designate identical elements that are common tothe figures.

DETAILED DESCRIPTION OF THE INVENTION

Method and apparatus for mode selection in a video encoder is described.One or more aspects of the invention relate to predictive frame (i.e.,INTER) mode selection in an H.264 video encoder or H.264-like encoder.Although the present invention is disclosed in the context of anH.264-like encoder, the present invention is not so limited. Namely, thepresent invention can be adapted to other motion compensation (MC)encoding standards. The INTER mode selection is independent of themotion estimation algorithm. In one embodiment, the INTER mode selectionis a one-pass decision algorithm aiming to approximate the multi-passR-D optimization based on encoder parameters and statistical data. Thealgorithm uses a bits model in which some of the components are measuredexactly, and the residual block bits are estimated through a statisticalmodel. The statistical model can be adapted based on the actual encodedbits.

Embodiments of the invention use the following definitions:

-   R Rate (bit-rate) of the encoder-   D Coding distortion of the encoder-   SAD Sum of absolute differences between a block and its    corresponding reference block or any similar metric-   QP Quantization parameter-   MV Motion vector for a macroblock or block-   MB_TYPE Partitioning of macroblock: one of 16×16, 16×8, 8×16, and    8×8-   SUB_MB_TYPE Partitioning of 8×8 block: one of 8×8, 8×4, 4×8, and 4×4-   MODE INTER macroblock partitioning. This is the set of values of    MB_TYPE and SUB_MB_TYPE

FIG. 1 is a block diagram depicting an exemplary embodiment of a videoencoder 100. In one embodiment, the video encoder is compliant with theH.264 standard. The video encoder 100 includes a subtractor 102, adiscrete cosine transform (DCT) module 104, a quantizer 106, an entropycoder 108, an inverse quantizer 110, an inverse DCT module 112, an adder114, a deblocking filter 116, a frame memory 118, a motion compensatedpredictor 120, an intra/inter switch 122, and a motion estimator 124.The video encoder 100 receives a sequence of source frames. Thesubtractor 102 receives a source frame from the input sequence and apredicted frame from the intra/inter switch 122. The subtractor 102computes a difference between the source frame and the predicted frame,which is provided to the DCT module 104. In INTER mode, the predictedframe is generated by the motion compensated predictor 120. In INTRAmode, a predicted MB is formed by the pixels from the neighboring MBs inthe same frame.

The DCT module 104 transforms the difference signal from the pixeldomain to the frequency domain using a DCT-like algorithm to produce aset of coefficients. The quantizer 106 quantizes the DCT coefficients.The entropy coder 108 codes the quantized DCT coefficients to produce acoded frame.

The inverse quantizer 110 performs the inverse operation of thequantizer 106 to recover the DCT coefficients. The inverse DCT module112 performs the inverse operation of the DCT-like module 104 to producea reconstructed difference signal. The reconstructed difference signalis added to the predicted frame by the adder 114 to produce areconstructed frame, which is coupled to the deblocking filter 116. Thedeblocking filter smoothes the reconstructed frame and stores thereconstructed frame in the frame memory 118. The motion compensatedpredictor 120 and the motion estimator 124 are coupled to the framememory 118 and are configured to obtain one or more previouslyreconstructed frames (previously coded frames).

The motion estimator 124 also receives the source frame. The motionestimator 124 performs a motion estimation algorithm using the sourceframes and previous reconstructed frames (i.e., reference frames) toproduce motion estimation data. The motion estimation data includesmotion vectors and associated references. The motion estimation data isprovided to the entropy coder 108 and the motion compensated predictor120. The entropy coder 108 codes the motion estimation data to producecoded motion data. The motion compensated predictor 120 performs amotion compensation algorithm using a previous reconstructed frame andthe motion estimation data to produce the predicted frame, which iscoupled to the intra/inter switch 122. Motion estimation and motioncompensation algorithms are well known in the art. In one embodiment,the motion estimator 124 includes mode decision logic 126. The modedecision logic 126 is configured to select a mode for each macroblock,or pair of macroblocks, in a predictive (INTER) frame. The “mode” of amacroblock is the partitioning scheme. That is, in one embodiment, themode decision logic 126 selects MODE for each macroblock in a predictiveframe.

The present invention sets forth at least one solution for selectingeither a frame coding mode or a field coding mode on both a per picturebasis or a per macroblock (MB) pair basis. In one embodiment, onesolution may include two separate yet related methods. Notably, thefirst method utilizes frame and field vertical pixel differencecomparisons, while the second method entails the use of a coding costprocedure.

The reasoning for using the frame and field vertical pixel differencecomparison method is two-fold. First, for stationary areas of a picturecomprising two fields, the difference between the consecutive pixels ofthe picture in the vertical direction tends to be smaller than thedifference between the consecutive pixels of each of two fields of thepicture in the vertical direction. Secondly, for moving areas of apicture comprising two fields, the difference between the consecutivepixels of the picture in the vertical direction tends to be larger thanthe difference between the consecutive pixels of each of two fields ofthe picture in the vertical direction.

Similarly, the coding costs (e.g., the motion estimation costs) of a MBpair in frame and field modes may also be used to determine whether aframe or a field coding mode is more suitable for a particular MB pair.In one embodiment, the coding cost (J) is defined as:

J=SAD+λ×f(MV,refldx,mbType)  Eq. 1

where SAD is a difference measurement between the pixels and their(temporal or spatial) predictions for every MB or sub-MB partition.Namely, pixel predictions come from either a temporal prediction or aspatial prediction. In one embodiment, SAD may also represent thedistortion present in an MB pair. Similarly, the MV variable representsmotion vectors, refldx is the reference picture index, and mbType is thetype of macroblocks or MB partitions. An MB partition may include anysub-macroblock configuration derived from a 16×16 MB, such as a 4×4block, an 8×8 block, or the like. The function portion of the equation,which attempts to serve as a representation of the number of codingbits, varies in accordance with the type of coding process that isconducted. For example, if the coding cost for intra prediction codingis needed, then the function does not consider the motion vectors or therefld variables. The variable λ represents a constant depending upon thequantization parameter and other coding parameters. In one embodiment,the variable λ may be utilized to nullify the units resulting from thefunction portion of the equation so that J results in a unitless value.The coding cost can be measured in either frame or field mode. Asdemonstrated below, a frame/field mode selection of an MB pair orpicture can be based upon the frame and field coding costs.

FIG. 2 is a flow diagram that depicts an exemplary embodiment of thepresent invention. Namely, method 200 describes the steps in which acoding mode is determined by one embodiment of the present invention.The method 200 begins at step 202 and proceeds to step 204 where atleast one block (e.g., a macroblock or a macroblock pair) of a signal tobe encoded is received.

At step 206, a frame vertical pixel difference in the at least one blockis determined.

At step 208, a field vertical pixel difference in the at least one blockis determined.

At step 210, the frame vertical pixel difference is compared with thefield vertical pixel difference to determine a first coding mode for theat least one block.

At step 211, method 200 performs the optional step of computing themotion estimation (ME) cost for both the frame coding mode and the filedcoding mode, where the two ME costs are then compared to further assistin the determining of a proper coding mode for the at least one block. Adetailed description of this step is further described below. The method200 ends at step 212.

It should be noted that although FIG. 2 illustrates the implementationof the motion estimation (ME) cost computation as being performed afterthe vertical pixel difference computation, this is only illustrative. Inother words, the motion estimation (ME) cost computation and thevertical pixel difference computation can be implemented in combinationor separately. As such, the motion estimation (ME) cost computation andthe vertical pixel difference computation can be performed in parallelor in any sequential order as required for a particular implementation.Thus, an implementation of the present invention may implement themotion estimation (ME) cost computation without the vertical pixeldifference computation or vice versa.

FIG. 3 is a flow diagram depicting an exemplary embodiment of a method300 for utilizing a frame and field vertical pixel comparison inaccordance with one or more aspects of the invention. Although thefollowing method specifically describes the processing of a block on anMB pair level, the method 300 can be similarly applied to processing ofa picture on a picture level.

The method 300 begins at step 302 and proceeds to step 304 where the sumof the differences between the absolute frame and field pixelsdifferences in the vertical direction is calculated. In one embodiment,the vertical frame pixel difference is determined to be:

$\begin{matrix}{\Delta_{FRM} = {\sum\limits_{j}^{\;}{{abs}{{X_{i,j} - X_{i,{j + 1}}}}}}} & {{Eq}.\mspace{14mu} 2}\end{matrix}$

where i and j are the pixel horizontal and vertical indices, and (i, j)are over the MB pair. This formula essentially involves thedetermination of the difference between two lines in the same framepicture (i.e. X_(i,j) represents a first line and X_(i,j+1) representsthe next line of the same MB). Similarly, in one embodiment, thevertical field pixel difference is determined to be:

$\begin{matrix}{\Delta_{FLD} = {{\sum\limits_{j}^{\;}{{abs}{{X_{i,{2j}} - X_{i,{2{({j + 1})}}}}}}} + {\sum\limits_{j}^{\;}{{abs}{{X_{i,{{2j} + 1}} - X_{i,{{2{({j + 1})}} + 1}}}}}}}} & {{Eq}.\mspace{14mu} 3}\end{matrix}$

This formula pertains to the sum of differences between lines withineach field of a MB. More specifically, the first component of theequation deals with the difference between two lines in a first field ina MB (e.g., a top field of a MB) and the second component of theequation deals with the difference between two lines in a second fieldof the same MB (e.g., the bottom field of same MB).

At step 306, the frame and field pixel differences in the verticaldirection are compared. Namely, in one embodiment, if the frame pixeldifference is greater than the field pixel difference (i.e.,Δ_(FRM)>Δ_(FLD)), then the method 300 continues to step 310. At step310, field coding mode is selected for the MB pair. Conversely, if theframe pixel difference is not greater than the field pixel difference,then the method 300 continues to step 308. At step 308, frame codingmode is selected for the MB pair. The method 300 ends at step 312.

The present invention also employs an optional procedure for utilizing acoding cost to determine the use of frame or field mode for anI-picture. An exemplary method 400 depicts one embodiment of such aprocess for an I-picture. Namely, FIG. 4 is a flow diagram depicting amethod 400 for determining a coding mode in accordance with one or moreaspects of the invention.

The method 400 begins at step 402 and proceeds to step 404 where atleast one intra frame prediction is performed. In one embodiment, anintra frame prediction is performed for all of the possible predictiondirections for an intra 4×4 sub-MB partition, an intra 8×8 sub-MBpartition, and an intra 16×16 macroblock for each MB of a given MB pair.For example, both the intra 4×4 MB and the 8×8 MB have nine directionsto be considered. Similarly, the 16×16 MB has four directions to beconsidered. Because this step is conducted in both the frame and fieldcoding modes for both the top and bottom MB of the MB pair, a total of736 direction calculations (i.e., (9 directions for 16 of 4×4 block+9directions for 4 of 8×8 block+4 directions for one of 16×16 block)*2 MBsin a MB pair*2 coding modes=736), may take place per MB pair in at leastone embodiment.

At step 406, in one embodiment, a minimum cost for each MB of a MB pairis determined. In one embodiment, the minimum costs of each MB in the MBpair are added together for both the frame mode and the field mode. Morespecifically, each of the directions calculated in step 404 (along withthe respective block type information) is applied to the coding costformula (see Eq. 1). Since method 400 pertains to I-pictures only, thecoding cost formula does not consider temporal predictions or motionestimation. Afterwards, a minimum cost is selected for each MB of the MBpair. For example, a first minimum cost (regardless of the block typeused to determine that minimum cost) is selected for the top MB and asecond minimum cost (regardless of the block type used to determine thatminimum cost) is selected for the bottom MB of the MB pair. A finalminimum cost is then calculated by summing the minimum cost for the topMB to the minimum cost of the bottom MB. Notably, this calculation isconducted for both the frame coding mode and the field coding mode sothat two separate final minimum costs, i.e., the minimum field cost(J_(FLDmin)) and the minimum frame cost (J_(FRMmin)), are respectivelydetermined.

At step 408, the calculated J_(FLDmin) and the J_(FRMmin) are compared.If J_(FRMmin) is not found to be greater than J_(FLDmin), then themethod 400 proceeds to step 410 where the frame coding mode is selectedfor the MB pair. Alternatively, if J_(FRMmin) is found to be greaterthan J_(FLDmin), then the method 400 proceeds to step 412 where thefield coding mode is selected for the MB pair. The method 400 ends atstep 414.

In an alternative embodiment, the method 400 may also be used todetermine a minimum coding cost on the picture level (as opposed to MBpair level). Notably, the alternative method is identical to method 400with the exception that after step 406, all of the minimum frame codingcosts and the minimum field coding costs per MB pair are summed over theentire picture in a separate manner. For example,

$\begin{matrix}{{J_{sum\_ FRMmin} = {\sum\limits_{i,j}^{\;}{J_{{FRM}\min}( {i,j} )}}}{and}{J_{sum\_ FLDmin} = {\sum\limits_{i,j}^{\;}{J_{{FRM}\min}( {i,j} )}}}} & {{Eq}.\mspace{14mu} 4}\end{matrix}$

Similarly, step 408 of method 400 would be replaced with the comparisonof J_(sum) _(—) _(FRMmin) and J_(sum) _(—) _(FLDmin). Consequently, ifJ_(sum) _(—) _(FRMmin) is found to be greater than J_(sum) _(—)_(FLDmin), then the field coding mode is selected for the picture.Alternatively, if J_(sum) _(—) _(FRMmin) is not found to be greater thanJ_(sum) _(—) _(FLDmin), then the frame coding mode is selected for thepicture.

The present invention also employs a procedure for utilizing a codingcost to determine the use of frame or field mode for P-pictures orB-pictures. An exemplary method 500 depicts one embodiment of such aprocess. Namely, FIG. 5 is a flow diagram depicting a method 500 fordetermining a coding mode in accordance with one or more aspects of theinvention.

In one embodiment, the method 500 begins at step 502 and proceeds tostep 504 where motion estimations (MEs) are performed for all possibleMBs or sub-MB partitions for each of the MB of a MB pair for both framemode and field mode. In one embodiment, an inter frame prediction isperformed for all of the possible prediction directions for a 4×4 sub-MBpartition, a 4×8 sub-MB partition, an 8×4 sub-MB partition, an 8×8sub-MB partition, an 8×16 sub-MB partition, a 16×8 sub-MB partition, anda 16×16 macroblock for each of the two MBs of a MB pair.

At step 506, the MB/sub-MB partition type with the minimum coding costis found for each MB of a MB pair in both the frame coding mode and thefield coding mode. In one embodiment, the present invention calculates amotion estimation cost using the cost coding formula (i.e., Eq. 1).Notably, the formula is applied to each of the seven different types ofMB/sub-MB partitions twice, once in the frame mode and then in the fieldmode, so that a minimum ME cost for both frame coding and field codingis calculated for each MB/sub-MB partition.

Afterwards, a minimum ME cost is selected for each MB of the MB pair.For example, a first minimum cost (regardless of the block type used todetermine that minimum cost) is selected for the top MB and a secondminimum ME cost (regardless of the block type used to determine thatminimum cost) is selected for the bottom MB of the MB pair. A finalminimum ME cost is then calculated by summing the minimum cost for thetop MB to the minimum cost of the bottom MB. Notably, this calculationis conducted for both the frame coding mode and the field coding mode sothat two separate final minimum costs, i.e., the minimum field cost(J_(FLDmin)) and the minimum frame cost (J_(FRMmin)), are respectivelydetermined.

At step 508, the calculated J_(FLDmin) and the J_(FRMmin) are compared.If J_(FRMmin) is found to be greater than J_(FLDmin), then the method500 proceeds to step 510 where the field mode is selected for the MBpair. Alternatively, if J_(FRMmin) is not found to be greater thanJ_(FLDmin), then the method 500 proceeds to step 512 where the framemode is selected for the MB pair. The method 500 ends at step 514.

In an alternative embodiment, the method 500 may also be used todetermining a minimum coding cost for a P-picture or B-picture on thepicture level (as opposed to MB pair level). Notably, the alternativemethod is identical to method 500 with the exception that after step506, all of the minimum frame coding costs and minimum field codingcosts are summed over the entire picture in a separate manner. Forexample,

$\begin{matrix}{{J_{sum\_ FRMmin} = {\sum\limits_{i,j}^{\;}{J_{{FRM}\min}( {i,j} )}}}{and}{J_{sum\_ FLDmin} = {\sum\limits_{i,j}^{\;}{J_{FLDmin}( {i,j} )}}}} & {{Eq}.\mspace{14mu} 5}\end{matrix}$

Similarly, step 508 of method 500 would be replaced with the comparisonof J_(sum) _(—) _(FRMmin) and J_(sum) _(—) _(FLDmin). Specifically, ifJ_(sum) _(—) _(FRMmin) is found to be greater than J_(sum) _(—)_(FLDmin), then the field coding mode is selected for the picture.Alternatively, if J_(sum) _(—) _(FRMmin) is not found to be greater thanJ_(sum) _(—) _(FLDmin), then the frame coding mode is selected for thepicture.

In one embodiment, on the MB pair level, the present inventiondetermines if the outcomes of the frame/field mode selection processbased on vertical pixel difference (e.g., method 300) and the codingcost process (e.g., method 400 for I pictures and method 500 for P and Bpictures) are the same. If the results are indeed the same, then theresult is considered final. If the results are different or there issome type of discrepancy, then additional criteria or calculations maybe required. For instance, the following formula could be used todetermine whether frame or field coding should be implemented:

$\begin{matrix}{\frac{{J_{FRMmin} - J_{FLDmin}}}{J_{FRMmin} + J_{FLDmin}} > {\alpha \frac{{\Delta_{FRM} - \Delta_{FLD}}}{\Delta_{FRM} + \Delta_{FLD}}}} & {{Eq}.\mspace{14mu} 6}\end{matrix}$

where α is a constant ranging from 0 to 1.0. If the above formula holdstrue, then the result from the coding cost formula should be used.Otherwise, the result from the frame/field vertical pixel differencecomparison should be used.

In an alternative embodiment, the present invention determines if theoutcomes of the frame/field mode selection process and the coding costprocess, as processed on the picture level, are the same. If the resultsare indeed are the same, then the result is considered final. If theresults are different or there is some type of discrepancy, thenadditional criteria may be required. For example, the final decision onthe frame and field mode per picture may be determined using Table 1below. The final decision is based on the decision from the abovecomparisons of the aforementioned alternative embodiments.

TABLE 1 Decision of Approach 1 Decision of Approach 2 Final DecisionFrame Frame Frame Frame Field Frame Field Frame Frame Field Field Field

In this particular embodiment, Table 1 is biased towards a frame codingmode because in a frame picture, MBAFF can be turned on, which mayfurther compensate an incorrect decision made at the picture level (ifany).

FIG. 6 is a block diagram depicting an exemplary embodiment of a videoencoder 600 in accordance with one or more aspects of the invention. Thevideo encoder 600 includes a processor 601, a memory 603, varioussupport circuits 604, and an I/O interface 602. The processor 601 may beany type of processing element known in the art, such as amicrocontroller, digital signal processor (DSP), instruction-setprocessor, dedicated processing logic, or the like. The support circuits604 for the processor 601 include conventional clock circuits, dataregisters, I/O interfaces, and the like. The I/O interface 602 may bedirectly coupled to the memory 603 or coupled through the processor 601.The I/O interface 602 may be coupled to a frame buffer and a motioncompensator, as well as to receive input frames. The memory 603 mayinclude one or more of the following random access memory, read onlymemory, magneto-resistive read/write memory, optical read/write memory,cache memory, magnetic read/write memory, and the like, as well assignal-bearing media as described below.

In one embodiment, the memory 603 stores processor-executableinstructions and/or data that may be executed by and/or used by theprocessor 601 as described further below. These processor-executableinstructions may comprise hardware, firmware, software, and the like, orsome combination thereof. Modules having processor-executableinstructions that are stored in the memory 603 may include a modeselection module 612. For example, the mode selection module 612 isconfigured to perform the methods 200, 300, 400, and 500 of FIGS. 2, 3,4, and 5 respectively. Although one or more aspects of the invention aredisclosed as being implemented as a processor executing a softwareprogram, those skilled in the art will appreciate that the invention maybe implemented in hardware, software, or a combination of hardware andsoftware. Such implementations may include a number of processorsindependently executing various programs and dedicated hardware, such asASICs.

An aspect of the invention is implemented as a program product forexecution by a processor. Program(s) of the program product definesfunctions of embodiments and can be contained on a variety ofsignal-bearing media (computer readable media), which include, but arenot limited to: (i) information permanently stored on non-writablestorage media (e.g., read-only memory devices within a computer such asCD-ROM or DVD-ROM disks readable by a CD-ROM drive or a DVD drive); (ii)alterable information stored on writable storage media (e.g., floppydisks within a diskette drive or hard-disk drive or read/writable CD orread/writable DVD); or (iii) information conveyed to a computer by acommunications medium, such as through a computer or telephone network,including wireless communications. The latter embodiment specificallyincludes information downloaded from the Internet and other networks.Such signal-bearing media, when carrying computer-readable instructionsthat direct functions of the invention, represent embodiments of theinvention.

While the foregoing is directed to illustrative embodiments of thepresent invention, other and further embodiments of the invention may bedevised without departing from the basic scope thereof, and the scopethereof is determined by the claims that follow.

1-21. (canceled)
 22. A method for selecting a coding mode per macroblockpair or picture, the method comprising: receiving at least one pair ofmacroblocks or at least one picture of a signal to be encoded;determining a sum of the absolute frame vertical pixel difference overthe at least one macroblock pair or over the entire picture; determininga sum of the absolute field vertical pixel difference over themacroblock pair or picture; comparing the frame vertical pixeldifference with the field vertical pixel difference in the verticaldirection; selecting a field coding mode for encoding the at least onemacroblock pair or picture if the frame vertical pixel difference isgreater than the field vertical pixel difference, else selecting a framecoding mode for encoding the at least one macroblock pair or picture.23. The method of claim 22, wherein the at least one pair of macroblocksor the at least one picture comprises a partition comprising at leastone of: a 16×16 block, a 16×8 block, an 8×16 block, an 8×8 block, an 8×4block, a 4×8 block, or a 4×4 block.
 24. A method for selecting a codingmode per macroblock pair or an I picture, the method comprising: performintra prediction for possible prediction directions for each of themacroblocks in the macroblock pair or for the I picture in both frameand field coding modes; for a macroblock pair: determine a minimum costfor each of the macroblocks in the macroblock pair in both the framecoding mode and the field coding mode; for an I picture: determining aminimum frame coding cost for all of the macroblocks in each of themacroblock pairs over the entire I picture by summing all of the minimumframe ME costs over the I picture; determining a minimum field codingcost for all of the macroblocks in each of the macroblock pairs over theentire I picture by summing all of the minimum field ME costs over the Ipicture; selecting a frame coding mode for encoding the macroblock pairor I picture if the minimum frame cost of the macroblock pair or pictureis less than the minimum field cost of the macroblock pair or I picture,else select the field coding mode for the macroblock pair or I picture.25. A method for selecting a coding mode per macroblock pair, P picture,or B picture, the method comprising: performing ME in both frame andfield coding modes for possible macroblock/sub_macroblock partitions foreach macroblock in a macroblock pair, P picture, or B picture; for amacroblock pair: determining a macroblock/sub_macroblock partitions witha minimum cost for each of the macroblocks in the macroblock pair, Ppicture, or B picture in both the frame and field coding modes; and fora P picture or B picture: determining a minimum frame coding cost forall of the macroblocks in each of the macroblock pairs over the entire Ppicture or B picture by summing all of the minimum frame ME costs overthe respective P picture or B picture; determining a minimum fieldcoding cost for all of the macroblocks in each of the macroblock pairsover the entire P picture or B picture by summing all of the minimumfield ME costs over the P picture or B picture, respectively; selectinga frame coding mode for encoding the macroblock pair, P picture, or Bpicture, if the minimum frame cost is less than the minimum field cost,else select the field coding mode for the macroblock pair, P picture, orB picture.
 26. A method for selecting a coding mode per macroblock pairor picture, the method comprising: identifying either a field codingmode or a frame coding mode for the macroblock pair or picture based ona vertical pixel difference comparison by: determining a sum of theabsolute frame vertical pixel difference (Δ_(FRM)) over the at least onemacroblock pair or picture, determining a sum of the absolute fieldvertical pixel difference (Δ_(FLD)) over the macroblock pair or picture,and comparing the frame vertical pixel difference with the fieldvertical pixel difference in the vertical direction; identifying a fieldcoding mode for encoding the at least one macroblock pair or picturepair if the frame vertical pixel difference is greater than the fieldvertical pixel difference, else identifying a frame coding mode forencoding the at least one macroblock pair or picture pair identifyingeither a field coding mode or a frame coding mode for the macroblockpair or picture based on a ME cost by: for a macroblock pair,determining a minimum cost for each of the macroblocks in the macroblockpair in both the frame coding mode (J_(min) _(—) _(FRM)) and fieldcoding modes (J_(min) _(—) _(FLD)); for a picture, determining a minimumframe coding cost for all of the macroblocks in each of the macroblockpairs over the entire I picture by summing all of the minimum frame MEcosts over the I picture and determining a minimum field coding cost forall of the macroblocks in each of the macroblock pairs over the entire Ipicture by summing all of the minimum field ME costs over the I picture;and identifying a frame coding mode for encoding the macroblock pair ifthe minimum frame cost of the macroblock pair is less than the minimumfield cost of the macroblock pair, else identifying the field codingmode for the macroblock pair; selecting the identified coding mode forencoding the macroblock pair or picture if the same coding mode isidentified based on both the vertical pixel difference comparison andthe ME cost, else if$\frac{{J_{min\_ FRM} - J_{min\_ FLD}}}{J_{min\_ FRM} + J_{min\_ FLD}} > {\alpha \frac{{\Delta_{FRM} - \Delta_{FLD}}}{\Delta_{FRM} + \Delta_{FLD}}}$select the coding mode identified based on the ME cost, or if$\frac{{J_{min\_ FRM} - J_{min\_ FLD}}}{J_{min\_ FRM} + J_{min\_ FLD}} < {\alpha \frac{{\Delta_{FRM} - \Delta_{FLD}}}{\Delta_{FRM} + \Delta_{FLD}}}$select the coding mode identified based on the vertical pixel differencecomparison.